<?

/**
* local collection functions of tocmenu_612
*
* @author Adesanto Asman
* @version 1.0
* @license Free
* @copyright Copyright (c)2007, Adesanto Asman
* @package CLFetchers
*
*/

/**
* @package CLFetchers
*
*/
class CLFetchers{

  /**
   * data header
   *
   * @param Database  $Db
   * @param string    $jobId
   * @param Composer  $SourceDb
   * @param integer   $nHeader
   * @param array     $lstHeader
   */
  function fetchLstDataHeader(&$Db,
                              &$jobId,
                              &$SourceDb,
                              &$nHeader,
                              &$lstHeader){

    $query  = "SELECT H.*,
                      M.MODEL,
                      M.UNIT
               FROM ".$SourceDb->fetchValue("srcDbHdr")."   H,
                    ".$SourceDb->fetchValue("srcDbModel")." M
               WHERE  H.JOB_ID='".$jobId."'
                      AND H.MODEL_ID=M.MODEL_ID ";

    $Db->execFetchQuery($query,
                        $nHeader,
                        $lstHeader);
  }

  /**
  * fetch the list of valid transactions
  *
  * @param  Database  $Db
  * @param  string    $condt      the condition
  * @param  Composer  $SourceDb
  * @param  string    $lstResult
  *
  */
  function fetchLstTransaction(&$Db,
                                $condt,
                               &$SourceDb,
                               &$nResult,
                               &$lstResult){

    $query  = "SELECT H.*,
                      M.MODEL
               FROM ".$SourceDb->fetchValue("srcDbHdr")."   H,
                    ".$SourceDb->fetchValue("srcDbModel")." M
               ".$condt."
                    AND H.MODEL_ID=M.MODEL_ID
               ORDER BY H.TR_DATE DESC ";

    $Db->execFetchQuery($query,
                        $nResult,
                        $lstResult);
  }
}

?>